package union

class Area {

	String nome
	String descricao
	
	String toString(){
		"${this.nome}"
	}

	static hasMany = [areasOrganograma:AreasOrganograma]
	
	/*controle many-to-many
	List organogramas(){
		return areasOrganograma.collect{it.organograma}
	}
	
	List addToOrganogramas(Organograma organograma){
		AreasOrganograma.link(this, organograma)
		return organogramas()
	}
	
	List removeFromOrganogramas(Organograma organograma){
		AreasOrganograma.unlink(this, organograma)
		return organogramas()
	}
	controle many-to-many*/
	
    static constraints = {
		nome(nullable:false, blank:false, unique:true)
		descricao(nullable:true, blank:true)
    }
}